const mysql = require("mysql")
const pool = mysql.createPool({
    host:"localhost",
    port:"3306",
    user:"root",
    password:"",
    database:"chenfeng",
    connectionLimit:20
})
//封装连接函数
function connect(sql,arr){
    return new Promise((resolve,reject)=>{
        pool.query(sql,arr,(err,data)=>{
            if(err) reject(err)            
            resolve(data)
        })
    })
}

module.exports = connect